//
//  BasePickerView.m
//  lingxi
//
//  Created by mac on 2023/12/14.
//

#import "BasePickerView.h"

@implementation BasePickerView
{
    UIView *_selectBackView;
}
-(void)layoutSubviews
{
    [super layoutSubviews];
    if(self.subviews.count){
        [self updateSelectView];
    }
}

-(void)updateSelectView
{
    //修改线条颜色
    if (self.subviews.count >1) {
        UIView *JKAPPLineView1 = self.subviews[0];
        JKAPPLineView1.backgroundColor = [UIColor clearColor];
    }
    if (self.subviews.count >1) {
        UIView *JKAPPLineView1 = self.subviews[1];
        JKAPPLineView1.backgroundColor = [UIColor clearColor];
    }

    if (self.subviews.count >2) {
        UIView *JKAPPLineView2 = self.subviews[2];
        JKAPPLineView2.backgroundColor = [UIColor clearColor];
    }
    
    //修改选中行的背景色
    for (UIView *subView in self.subviews) {
        if(subView.subviews.count){
            UIView *JKAPPContenTView = subView.subviews[0];
            for (UIView *contentSubView in JKAPPContenTView.subviews) {
                CGFloat y1 = contentSubView.center.y;
                CGFloat y2 = JKAPPContenTView.center.y;
                if((int)y1 == (int)y2){
                    if(_selectBackView != contentSubView){
                        _selectBackView.backgroundColor = [UIColor clearColor];
                        _selectBackView = contentSubView;
                        _selectBackView.backgroundColor = ColorHex_Alpha(@"#999999", 0.3);
                    }
                    break;
                }
            }
            break;
        }
    }
    
    
    
}
@end
